#!/bin/sh -x
# shellcheck disable=2034
coded_by='

In the name of Allah, the most Gracious, the most Merciful.

 ▓▓▓▓▓▓▓▓▓▓
░▓ Author ▓ Abdullah <https://abdullah.today>
░▓▓▓▓▓▓▓▓▓▓ YouTube <https://YouTube.com/AbdullahToday>
░░░░░░░░░░


'
# Toggles touchpad

device_name="$(xinput list | grep -Eio '(touchpad|glidepoint)\s*id\=[0-9]{1,2}'\
    | grep -Eo '[0-9]{1,2}')"
is_enabled="$(xinput list-props $device_name | grep 'Device Enabled' | \
    awk '{print $4}')"

if [ ${is_enabled} -eq 1 ]; then
    xinput disable $device_name
    notify-send -u critical -t 1200 'Touchpad disabled'
else
    xinput enable $device_name
    notify-send 'Touchpad enabled'
fi
